
/**
 * Record pre-delete trigger.
 * Validate the record to be deleted.
 * When false is returned the record will not be deleted in the database.
 * When an exception is thrown the record will also not be deleted in the database but it will be added to databaseManager.getFailedRecords(),
 * the thrown exception can be retrieved via record.exception.getValue().
 *
 * @param {JSRecord<db:/infocom/proveedor>} record record that will be deleted
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"B7593F1F-5CB5-4053-A719-FEDF8C6723E7"}
 */
function onProveedorRecordDelete(record) {
	if (record.proveedor_to_ctacte_pr.getSize() > 0)
	{
		globals.DIALOGS.showWarningDialog('Aviso','El proveedor tiene movimientos asociados. No puede eliminar','OK')
		return false
	}
	globals.altaLog(2,'proveedor',record.proveedor_id,record.codigo_anterior,'Baja del proveedor: '+record.razon_social)
	return true
}
